export default {
  namespaced: true,
  state: {
    itemWidth: {
      left: 0,
      right: 0,
      center: 0
    },
    itemHeight: {
      top: 0,
      bottom: 0,
      center: -1
    },
    itemVisible: {
      left: true,
      right: true,
      center: true,
      bottom: true,
      top: true
    },
    btnWidth: {
      left: 0,
      right: 0
    },
    btnHeight: {
      top: 0,
      bottom: 0
    }
  },
  mutations: {
    setItemSize(state, payload) {
      const { itemPos, str, value } = payload;
      str === "width"
        ? (state.itemWidth[itemPos] = value)
        : (state.itemHeight[itemPos] = value);
    },
    setItemVisible(state, payload) {
      const { itemPos, visible } = payload;
      state.itemVisible[itemPos] = visible;
    },
    setBtnWidth(state, payload) {
      const { itemPos, width } = payload;
      state.btnWidth[itemPos] = width;
    },
    setBtnHeight(state, payload) {
      const { itemPos, height } = payload;
      state.btnHeight[itemPos] = height;
    }
  }
};
